package org.lgiavedoni.android.franq.service.phone.location.updatelocation.imp;

import org.lgiavedoni.android.franq.core.cron.CronTask;
import org.lgiavedoni.android.franq.core.cron.RepetibleCron;
import org.lgiavedoni.android.franq.core.position.PositionManager;
import org.lgiavedoni.android.franq.service.config.ConfigService;
import org.lgiavedoni.android.franq.service.config.ConfigService.ConfigKey;
import org.lgiavedoni.android.franq.service.log.Logger;

public class UpdateLocationByTimeStrategyCron extends CronTask implements RepetibleCron {

	@Override
	public void run() {
		Logger.inst.info("Running UpdateLocationByTimeStrategyCron");
		PositionManager.inst.tryToUpdatePosition();
	}

	@Override
	public long getDelay() {
		return 5000;
	}

	@Override
	public long getPeriod() {
		return ConfigService.inst.getValueAsLong(ConfigKey.POSITION_UPDATE_PERIOD);
	}
}
